
package com.probiz.estore.customer.dao;

import java.util.List;
import java.util.Map;

import com.probiz.estore.common.model.customer.Membership;
import com.probiz.estore.core.dao.GenericDao;

/**
 * Membership Data Access Object (DAO) interface. Developer introduced
 * interfaces should be declared here. Won't get overwritten.
 */
public interface MembershipDao extends GenericDao<Membership> {

	/**
	 * 获得比该等级更低的会员等级实体
	 * @param level 指定等级
	 * @return
	 */
	public Membership getLowerLevelMembership(Integer level);
	/**
	 * 获得比该等级更高的会员等级实体
	 * @param level
	 * @return
	 */
	public Membership getHigherLevelMembership(Integer level);
	/**
	 * 判断不是membershipId，但相同level的等级是否存在
	 * @param membershipId
	 * @param level
	 * @return
	 */
	public boolean isLevelExist(Integer membershipId, Integer level);

	/**
	 * 获得所有会员等级，并根据指定的等级升降序排序
	 * @param isAsc 是否升序排序
	 * @return
	 */
	public List<Membership> getAllMembershipsOrderByLevel(boolean isAsc);
	/**
	 * 获取除membershipId以外的等级列表
	 * @param isAsc
	 * @param membershipId
	 * @return
	 */
	public List<Membership> getAllMembershipsOrderByLevelExcluedOne(boolean isAsc,Integer membershipId);
	
	/**
	 * 将所有的客户的旧会员等级更新到新的会员等级 直接用JDBC API方法
	 * @param preMembershipId 原来的membershipId
	 * @param postMembershipId 后来的membershipId
	 */
	public void doUpdateCustomerMembership(Integer preMembershipId,Integer postMembershipId);

	//for eai
	public Map getMaxMemberLevelAndUpgradeShopPoint();

}
